home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / etc / init.d / wpa-ifupdown < prev    next >
Encoding:
Text File  |  2007-04-01  |  1.6 KB  |  70 lines

  1. #!/bin/sh
  2.  
  3. ### BEGIN INIT INFO
  4. # Provides:        wpa-ifupdown
  5. # Required-Start:    $network
  6. # Required-Stop:    $network
  7. # Should-Start:
  8. # Should-Stop:
  9. # Default-Start:
  10. # Default-Stop:        0 6
  11. # Short-Description:    Stop wpa_supplicant processes started via ifupdown
  12. # Description:        Run ifdown on interfaces authenticated via
  13. #            wpa_supplicant.    Sendsigs terminates wpa_supplicant
  14. #            processes before networking is stopped causing each
  15. #            network interface authenticated via a wpa_supplicant
  16. #            daemon to be terminated abrubtly.
  17. ### END INIT INFO
  18.  
  19. PATH=/usr/sbin:/usr/bin:/sbin:/bin
  20.  
  21. test -d /var/run || exit 0
  22.  
  23. test -x /sbin/ifdown || exit 0
  24.  
  25. . /lib/lsb/init-functions
  26.  
  27. stop_wpa_action () {
  28.     test -x /sbin/wpa_action || return
  29.     unset IFACES
  30.     IFACES=$(find /var/run -maxdepth 1 -type f -name 'wpa_action.*.pid' -printf '%P\n' | cut -d'.' -f2)
  31.     if test -n "$IFACES"; then
  32.         log_daemon_msg "Stopping wpa_action roaming interfaces"
  33.         for iface in $IFACES; do
  34.             log_progress_msg "$iface"
  35.             # wpa_action executes /sbin/ifdown
  36.             wpa_action "$iface" stop >/dev/null 2>&1
  37.         done
  38.         log_end_msg 0
  39.     fi
  40. }
  41.  
  42. stop_wpa_supplicant () {
  43.     unset IFACES
  44.     IFACES=$(find /var/run -maxdepth 1 -type f -name 'wpa_supplicant.*.pid' -printf '%P\n' | cut -d'.' -f2)
  45.     if test -n "$IFACES"; then
  46.         log_daemon_msg "Stopping wpa_supplicant interfaces"
  47.         for iface in $IFACES; do
  48.             log_progress_msg "$iface"
  49.             ifdown $iface >/dev/null 2>&1
  50.         done
  51.         log_end_msg 0
  52.     fi
  53. }
  54.  
  55. case "$1" in
  56.     start|restart|force-reload)
  57.         # No-op
  58.         ;;
  59.     stop)
  60.         stop_wpa_action
  61.         stop_wpa_supplicant
  62.         ;;
  63.     *)
  64.         echo "Usage: $0 {start|stop|restart|force-reload}" >&2
  65.         exit 3
  66.         ;;
  67. esac
  68.  
  69. exit 0
  70.